package com.blog.effective.note8;

/**
 * 〈一个点类〉<br>
 *
 * @author 未绪
 * @time 2017/12/17 11:50
 */
public class Point {

    //该点是二位平面上的点
    private int x;
    private int y;

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    //    @Override
//    public boolean equals(Object obj) {
//        if(obj instanceof Point){
//            Point p = (Point)obj;
//            return p.x==this.x&&p.y==this.y;
//        }
//        return false;
//    }
    @Override
    public boolean equals(Object obj) {
        if (obj == null || this.getClass() != obj.getClass()) {
            return false;
        }
        Point p = (Point) obj;
        return p.x == this.x && p.y == this.y;
    }
}
